class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        int size = price.size();
        int left =0,right = size-1;
        int sum = 0;
        while(left<right)
        {
            sum= price[left]+price[right];
            if(sum>target)
                --right;
            else if(sum<target)
                ++left;
            else 
                break;
        }
        return {price[left],price[right]};
    }
};